package com.szzg10.webservice.chapter3;

import java.util.Map;

import javax.annotation.Resource;
import javax.jws.HandlerChain;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;

@WebService
@HandlerChain(file = "handler-chain-echo-server.xml")
public class Echo {

	@Resource private WebServiceContext webServiceContext;
	
	@WebMethod
	public String echo(String client) {
		
		MessageContext ctx = webServiceContext.getMessageContext();
		
		Map map = (Map)ctx.get(MessageContext.HTTP_REQUEST_HEADERS);
		MapDump.dump_map(ctx, "");
		
		String response = "Echoing your message: " + client;
		return response;
	}
}
